#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	int n,l,r,ans=0;
	scanf("%d %d %d",&n,&l,&r);
	if(r-l>=n){
		ans = ((r/n)*n - 1)%n;
	}
	else if(r-l<n){
		ans = r%n;
	}
	printf("%d",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
